<include file="Public/header"/>
<div class="row">
    <div class="wrapper wrapper-content animated">
        <div class="ibox-content">
            <div class="deal-bd order-bottom">商户信息管理</div>
            <div class="layui-tab">
                <ul class="layui-tab-title">
                    <li class="layui-this"><a href="<{:U('Account/profile')}>">商户基本信息</a></li>
                    <li class=""><a href="<{:U('Account/bankcard')}>">银行卡管理</a></li>
                    <li class=""><a href="<{:U('Account/editPassword')}>">登录密码</a></li>
                    <li class=""><a href="<{:U('Account/editPaypassword')}>">支付密码</a></li>
                </ul>
                <div class="layui-tab-content">
                    <!--商户信息-->
                    <div class="layui-tab-item layui-show">
                        <form class="layui-form" action="" autocomplete="off" id="profile">
                            <input type="hidden" name="id" value="<{$p.id}>">
                            <div class="layui-form-item">
                                <div class="layui-block">
                                    <label class="layui-form-label" style="width:110px">姓名：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="text" name="p[realname]" lay-verify="title" autocomplete="off"
                                               placeholder="姓名" class="layui-input" value="<{$p.realname}>">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-block">
                                    <label class="layui-form-label" style="width:110px">身份证号：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="text" name="p[sfznumber]" lay-verify="identity" placeholder="身份证号码" autocomplete="off" class="layui-input" value="<{$p.sfznumber}>">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width:110px">性别：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <select name="u[sex]" lay-search="">
                                            <option <if condition="$u['sex'] eq 0">selected</if> value="0">女</option>
                                            <option <if condition="$u['sex'] eq 1">selected</if> value="1">男</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width:110px">出生日期：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="text" name="p[birthday]" id="date" lay-verify="date" placeholder="YYYY-MM-dd" autocomplete="off" class="layui-input" value="<{$p.birthday|date='Y-m-d',###}>">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width:110px">手机号码：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="text"  lay-verify="phone" name="p[mobile]" autocomplete="off"
                                               class="layui-input" value="<{$p.mobile}>">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width:110px">QQ：</label>
                                    <div class="layui-input-inline" style="width:240px">
                                        <input type="text" name="p[qq]" lay-verify="" autocomplete="off"
                                               class="layui-input" value="<{$p.qq}>">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width:110px">联系地址：</label>
                                    <div class="layui-input-inline" style="width:500px">
                                        <input type="text" name="p[address]" lay-verify="title" autocomplete="off"
                                               placeholder="联系地址" class="layui-input" value="<{$p.address}>">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"></label>
                                    <button class="btn btn-primary" lay-submit="" lay-filter="profile">提交保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="Public/footer"/>
<script>
    function load_url(url){
        var url = $(url).data('url');
        location.href = url;
    }
layui.use(['laydate', 'laypage', 'layer', 'form', 'element'], function() {
    var laydate = layui.laydate //日期
        ,layer = layui.layer //弹层
        ,form = layui.form //弹层
        , element = layui.element; //元素操作
    //日期
    laydate.render({
        elem: '#date'
    });
    //监听提交
    form.on('submit(profile)', function(data){
        $.ajax({
            url:"<{:U('Account/saveProfile')}>",
            type:"post",
            data:$('#profile').serialize(),
            success:function(res){
                if(res.status){
                    layer.alert("编辑成功", {icon: 6},function () {
                        parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                }else{
                    layer.alert("操作失败", {icon: 5},function () {
                        parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                }
            }
        });
        return false;
    });
    //绑定手机
    $('.bindMobile').click(function(){
        var id = $(this).data('id');
        x_admin_show('绑定手机', "<{:U('Account/bindMobileShow')}>?id=" + id, '600', '300');
        
    })
        //修改手机
    $('.editMobile').click(function(){
        var id = $(this).data('id');
        x_admin_show('修改手机', "<{:U('Account/editMobileShow')}>?id=" + id, '600', '300');
        
    })

});

</script>
</body>
</html>